#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
const int N = 1e5 + 10;
int q;

int main()
{
    cin >> q;
    unordered_map<int, int> mp;
    int mina = 0x3f3f3f3f;
    int cnt = 0;
    while(q--)
    {
        int k; cin >> k;
        cnt += k;
        int pre = 0;
        for(int i = 1; i <= k; i++)
        {
            int x; cin >> x;
            if(x <= pre)
            {
                cout << "NO" << endl;
                return 0;
            }
            mp[x]++;
            pre = x;
            mina = min(mina, x);
        }
    }
    for(int i = mina; i <= mina + cnt - 1; i++)
    {
        if(!mp.count(i))
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}